<?php

$this->breadcrumbs = array(
	$model->label(2) => array('admin'),
	UserModule::t('Управление'),
);

$this->menu = array(
		array('label'=>UserModule::t('Создание') . ' ' . $model->label(), 'url'=>array('create')),
	);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('firms-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1><?php echo UserModule::t('Управление') . ' ' . GxHtml::encode($model->label(2)); ?></h1>

<?php echo GxHtml::link(UserModule::t('Расширенный поиск'), '#', array('class' => 'search-button')); ?>
<div class="search-form hidden">
<?php $this->renderPartial('_search', array(
	'model' => $model,
)); ?>
</div><!-- search-form -->
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id' => 'firms-grid',
	'dataProvider' => $model->search(),
	'filter' => $model,
	'columns' => array(
		'id',
		'crdate',
		array(
					'name' => 'hidden',
					'value' => '($data->hidden == 0) ? Yii::t(\'app\', \'Нет\') : Yii::t(\'app\', \'Да\')',
					'filter' => array('0' => Yii::t('app', 'Нет'), '1' => Yii::t('app', 'Да')),
					),
		array(
				'name'=>'user_id',
				'value'=>'GxHtml::valueEx($data->user)',
				'filter'=>GxHtml::listDataEx(Users::model()->findAllAttributes(null, true)),
				),
		array(
				'name'=>'firm_tmpl_id',
				'value'=>'GxHtml::valueEx($data->firmTmpl)',
				'filter'=>GxHtml::listDataEx(FirmTmpls::model()->findAllAttributes(null, true)),
				),
		'title',
		/*
		'description',
		array(
				'name'=>'city_id',
				'value'=>'GxHtml::valueEx($data->city)',
				'filter'=>GxHtml::listDataEx(Cities::model()->findAllAttributes(null, true)),
				),
		'address',
		array(
				'name'=>'country_id',
				'value'=>'GxHtml::valueEx($data->country)',
				'filter'=>GxHtml::listDataEx(Countries::model()->findAllAttributes(null, true)),
				),
		array(
				'name'=>'region_id',
				'value'=>'GxHtml::valueEx($data->region)',
				'filter'=>GxHtml::listDataEx(Regions::model()->findAllAttributes(null, true)),
				),
		'phone',
		array(
					'name' => 'active',
					'value' => '($data->active == 0) ? Yii::t(\'app\', \'Нет\') : Yii::t(\'app\', \'Да\')',
					'filter' => array('0' => Yii::t('app', 'Нет'), '1' => Yii::t('app', 'Да')),
					),
		'start_date',
		'activated_by',
		'end_date',
		array(
				'name'=>'rubric_id',
				'value'=>'GxHtml::valueEx($data->rubric)',
				'filter'=>GxHtml::listDataEx(Rubrics::model()->findAllAttributes(null, true)),
				),
		array(
				'name'=>'category_id',
				'value'=>'GxHtml::valueEx($data->category)',
				'filter'=>GxHtml::listDataEx(Categories::model()->findAllAttributes(null, true)),
				),
		'rating_order',
		'author_id',
		'zip',
		*/
		array(
			'class' => 'CButtonColumn',
		),
	),
)); ?>

<p class="search_advice">
You may optionally enter a comparison operator (&lt;, &lt;=, &gt;, &gt;=, &lt;&gt; or =) at the beginning of each of your search values to specify how the comparison should be done.
</p>
